19. Notebook + 练习:多重共线性与 VIF
Workspace
This section contains either a workspace (it can be a Jupyter Notebook workspace or an online code editor work space, etc.) and it cannot be automatically downloaded to be generated here. Please access the classroom with your account and manually download the workspace to your local machine. Note that for some courses, Udacity upload the workspace files onto https://github.com/udacity , so you may be able to download them there.
Workspace Information:
- Default file path:
- Workspace type: jupyter
- Opened files (when workspace is loaded): n/a
SOLUTION:
- 看起来自变量彼此相关。
- 看起来最相关的变量是卧室数和浴室数。
SOLUTION:
- 随着浴室数增加,我们预测房价会上升。
- 随着住宅面积的增加,我们预测房价会上升
SOLUTION:
因为卧室和浴室变量的 VIF 都大于 10,所以我们应该删除卧室或浴室。SOLUTION:
- 现在所有 VIF 都小于 10。
- 正如我们所预料的,现在所有系数都是正值了。
- 决定系数有两个数位保持不变,意味着模型里并不需要卧室和浴室同时存在。